<template>
  <nm-container>
    <el-form label-width="80px" :inline="true" style="background:white;padding-top:20px">
      <el-form-item label="起始日期">
        <el-date-picker v-model="form.busDate" type="date" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"> </el-date-picker>
      </el-form-item>
      <nm-button type="primary" @click="getBill" text="查 询"></nm-button>
    </el-form>

    <el-table
      ref="topictable"
      :max-height="tabheight"
      :data="getList"
      border
      align="center"
      :header-cell-style="{ 'text-align': 'center', 'font-weight': 'bold', color: '#030202' }"
      :cell-style="{ 'text-align': 'center' }"
      style="width: 100%;text-align: center;margin-top:30px"
    >
      <!-- <el-table-column type="selection" width="55"> </el-table-column> -->
      <el-table-column prop="name" label="售票员代码"> </el-table-column>
      <el-table-column prop="userName" label="姓名"> </el-table-column>
      <el-table-column prop="currentTicketNum" label="小组"> </el-table-column>
      <el-table-column prop="remainTicket" label="起票号"> </el-table-column>
      <el-table-column prop="name" label="止票号"> </el-table-column>
      <el-table-column prop="name" label="售票张数"> </el-table-column>
      <el-table-column prop="ticketCashMoney" label="收票款-现金">
        <template slot-scope="scope">
          <span>{{ scope.row.userDayBill.ticketCashMoney }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="ticketMobilePayMoney" label="收票款-移动支付">
        <template slot-scope="scope">
          <span>{{ scope.row.userDayBill.ticketMobilePayMoney }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="取票张数"> </el-table-column>
      <el-table-column prop="name" label="取票款"> </el-table-column>
      <el-table-column prop="name" label="废票张数"> </el-table-column>
      <el-table-column prop="name" label="废票款"> </el-table-column>
      <el-table-column prop="refundTicketAmount" label="退票张数">
        <template slot-scope="scope">
          <span>{{ scope.row.userDayBill.refundTicketAmount }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="退票款-现金"> </el-table-column>
      <el-table-column prop="name" label="退票款-移动支付"> </el-table-column>
      <el-table-column prop="name" label="白票"> </el-table-column>
      <el-table-column prop="name" label="登录时间"> </el-table-column>
      <el-table-column prop="name" label="登录地点"> </el-table-column>
      <el-table-column prop="name" label="是否在线"> </el-table-column>
      <el-table-column prop="name" label="状态"> </el-table-column>
    </el-table>
    <!-- <el-pagination background layout="prev, pager, next" :total="getList.total / 10" /> -->
  </nm-container>
</template>
<script>
import { mixins } from 'netmodular-ui'
import page from './page'
import cols from './cols'
// import SavePage from '../components/save'
// import detailList from '../components/detailList'

const api = $api.dispatch.settle_accounts

export default {
  name: page.name,
  mixins: [mixins.list],
  // components: { SavePage, detailList },
  data() {
    return {
      getList: [],
      form: {
        busDate: ''
      },
      list: {
        title: page.title,
        cols,
        action: api.query,
        model: {
          /** 线路名称 */
          route_name: ''
        }
      },
      removeAction: api.remove,
      buttons: page.buttons,
      tabheight: 400,
      formLabelWidh: '80px'
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.tabheight = window.innerHeight - this.$refs.topictable.$el.offsetTop - 300
    })
    this.getTime()
  },
  methods: {
    handleSelectionChange(row) {
      console.log(row)
    },
    getBill() {
      api.queryuserdaybill({ date: this.form.busDate }).then(res => {
        if (res.length == '0') {
          this.$message.warning('未查询到数据')
          this.getList = []
        } else {
          this.getList = res
        }
      })
    },
    // 获取当天日期
    getTime() {
      let date = new Date()
      let y = date.getFullYear()
      let m = new Date().getMonth() + 1 < 10 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1
      let d = date.getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate()
      this.form.busDate = y + '-' + m + '-' + d
      // this.busDate = isDate
    }
  }
}
</script>
<style scoped></style>
